import Vue from 'vue'
import App from './App.vue'
import router from './router'

import echarts    from 'echarts';
import vuescroll  from 'vuescroll/dist/vuescroll';
import countTo    from 'vue-count-to';
import utils      from './utils/utils.js'
import api        from './axios/api.js'
import ElementUI from 'element-ui';
import './assets/css/style/theme/index.css';

// 计算属性全局绑定
import * as filters from './filters/filters.js';

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});

Vue.prototype.$echarts = echarts;
Vue.prototype.$api = api;
Vue.component('countTo', countTo);

Vue.use(vuescroll);
Vue.use(ElementUI);
Vue.use(utils);

Vue.config.productionTip = false;

new Vue({
  router,
  render: h => h(App),
  data(){
    return {
      scrollOps: {
        vuescroll: {
          mode: 'native',//Utils.browser.version.mobile ? 'slide' : 'native'
        },
        rail: {},
        scrollPanel: {
          //scrollingX:false,
          easing:'easeInQuad'
        },
        bar: {
          showDelay: 500,
          onlyShowBarOnScroll: false,
          keepShow: true,
          background: 'rgba(0,0,0,0.4)',
          opacity: 1,
          hoverStyle: false,
          specifyBorderRadius: false,
          minSize: 0.1,
          size: '10px',
          disable: false,
        }
      }
    }
  },
  computed: {
    scrollOpsX(){
      return Object.assign({}, this.scrollOps, {scrollPanel: {
          scrollingY:false
        }});
    },
    scrollOpsY(){
      return Object.assign({}, this.scrollOps, {scrollPanel: {
          scrollingX:false,
        }});
    },
    scrollOpsSlider(){
      return Object.assign({}, this.scrollOps, {vuescroll: {
          mode: 'slide',
        }});
    }
  }
}).$mount('#app')
